<?php

namespace Renshan\DetectorBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Result
 *
 * @ORM\Table(name="result")
 * @ORM\Entity(repositoryClass="Renshan\DetectorBundle\Repository\ResultRepository")
 */
class Result
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var array
     *
     * @ORM\Column(name="headers", type="array", nullable=true)
     */
    private $headers;

    /**
     * @var string
     *
     * @ORM\Column(name="body", type="text", nullable=true)
     */
    private $body;

    /**
     * @var int
     *
     * @ORM\Column(name="status_code", type="integer")
     */
    private $statusCode;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="time", type="time")
     */
    private $time;

    /**
     *
     * @var float
     *
     * @ORM\Column(name="duration", type="float")
     */
    private $duration;

    /**
     * @ORM\ManyToOne(targetEntity="Target", inversedBy="results")
     */
    private $target;

    /**
     * @ORM\ManyToOne(targetEntity="ReqGroup", inversedBy="results")
     */
    private $req_group;



    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set headers
     *
     * @param array $headers
     *
     * @return Result
     */
    public function setHeaders($headers)
    {
        $this->headers = $headers;

        return $this;
    }

    /**
     * Get headers
     *
     * @return array
     */
    public function getHeaders()
    {
        return $this->headers;
    }

    /**
     * Set body
     *
     * @param string $body
     *
     * @return Result
     */
    public function setBody($body)
    {
        $this->body = base64_encode($body);

        return $this;
    }

    /**
     * Get body
     *
     * @return string
     */
    public function getBody()
    {
        return base64_decode($this->body);
    }

    /**
     * Set statusCode
     *
     * @param integer $statusCode
     *
     * @return Result
     */
    public function setStatusCode($statusCode)
    {
        $this->statusCode = $statusCode;

        return $this;
    }

    /**
     * Get statusCode
     *
     * @return int
     */
    public function getStatusCode()
    {
        return $this->statusCode;
    }

    /**
     * Set time
     *
     * @param \DateTime $time
     *
     * @return Result
     */
    public function setTime($time)
    {
        $this->time = $time;

        return $this;
    }

    /**
     * Get time
     *
     * @return \DateTime
     */
    public function getTime()
    {
        return $this->time;
    }

    /**
     * Set target
     *
     * @param \Renshan\DetectorBundle\Entity\Target $target
     *
     * @return Result
     */
    public function setTarget(\Renshan\DetectorBundle\Entity\Target $target = null)
    {
        $this->target = $target;

        return $this;
    }

    /**
     * Get target
     *
     * @return \Renshan\DetectorBundle\Entity\Target
     */
    public function getTarget()
    {
        return $this->target;
    }

    /**
     * Set duration
     *
     * @param float $duration
     *
     * @return Result
     */
    public function setDuration($duration)
    {
        $this->duration = $duration;

        return $this;
    }

    /**
     * Get duration
     *
     * @return float
     */
    public function getDuration()
    {
        return $this->duration;
    }

    /**
     * Set reqGroup
     *
     * @param \Renshan\DetectorBundle\Entity\ReqGroup $reqGroup
     *
     * @return Result
     */
    public function setReqGroup(\Renshan\DetectorBundle\Entity\ReqGroup $reqGroup = null)
    {
        $this->req_group = $reqGroup;

        return $this;
    }

    /**
     * Get reqGroup
     *
     * @return \Renshan\DetectorBundle\Entity\ReqGroup
     */
    public function getReqGroup()
    {
        return $this->req_group;
    }
}
